package com.xuecheng.teaching.convert;

import com.xuecheng.api.learning.model.dto.CourseRecordDTO;
import com.xuecheng.api.teaching.model.dto.CompanyDTO;
import com.xuecheng.api.teaching.model.dto.CourseWorkRecDTO;
import com.xuecheng.api.teaching.model.dto.WorkDTO;
import com.xuecheng.api.teaching.model.dto.WorkRecordDTO;
import com.xuecheng.api.teaching.model.vo.WorkRecordVO;
import com.xuecheng.teaching.entity.Company;
import com.xuecheng.teaching.entity.CourseWorkRec;
import com.xuecheng.teaching.entity.Work;
import com.xuecheng.teaching.entity.WorkRecord;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author: NFY
 * @date: 2021/4/20
 * @Description:
 */
@Mapper
public interface CourseWorkConvert {

    CourseWorkConvert INSTANCE = Mappers.getMapper(CourseWorkConvert.class);

    @Mappings({
            @Mapping(source = "id",target = "courseWorkId"),
            @Mapping(source = "answerNumber",target = "totalUsers")
    })
    CourseWorkRecDTO entity2dto(CourseWorkRec courseWorkRec);

    @Mapping(source = "courseWorkId",target = "id")
    CourseWorkRec dto2entity(CourseWorkRecDTO dto);

    @Mapping(source = "id",target = "workRecordId")
    WorkRecordDTO entity2DTO(WorkRecord workRecord);

    @Mapping(source = "workRecordId",target = "id")
    WorkRecord dto2entity(WorkRecordDTO workRecordDTO);


    WorkRecordDTO vo2dto(WorkRecordVO workRecordVO);


    List<CourseWorkRecDTO> entitys2dtos(List<CourseWorkRec> courseWorkRecList);

    List<WorkRecordDTO> entitys2DTOs(List<WorkRecord> workRecordList);

}
